import json
class ConfigFile:
    def __init__(self,file,encoding="utf-8"):
        try:
            file=open(file,"r",encoding=encoding)
        except FileNotFoundError:
            raise FileNotFoundError("Config file doesn't exist.")
        else:
            self.data=file.read()
        try:
            self.data=json.loads(self.data)
        except json.JSONDecodeError:
            raise SystemError("Json decode failed.")
    def read(self,name):
        try:
            return self.data[name]
        except KeyError:
            raise SystemError("The specified key doesn‘t exist.")

